API Documentation
Classes | Public Member Functions | List of all members
nkWinUi::TreeView Class Referenceabstract

A graphical tree view window. More...

Inheritance diagram for nkWinUi::TreeView:
nkWinUi::Component nkExport::Exportable

Classes

class  Item
 Holds information of a tree view item. More...
 

Public Member Functions

 TreeView (MainSystem *parentSystem)
 
 ~TreeView ()
 
ItemgetItemFromData (void *data) const
 
virtual ItemgetSelectedItem ()=0
 
virtual ItemgetItemAtAbsoluteCursor (const nkMaths::Point &absCoords)=0
 
virtual ItemgetItemAtRelativeCursor (const nkMaths::Point &relCoords)=0
 
bool getSelectOnRightClick () const
 
std::function< void(TreeView *)> getSelectionCallback () const
 
void setSelectionOnRightClick (bool value)
 
void setSelectionCallback (std::function< void(TreeView *)> value)
 
virtual IteminsertItem (const std::string_view &text, void *data, Item *parent=nullptr, Item *afterThisOne=nullptr)
 
virtual void deleteItem (Item *toDelete, bool keepChildrenOnUpper=false)
 
virtual void changeItemLabel (Item *toChange, const std::string_view &label)
 
virtual void clearItems ()
 
void selectItemFromItsData (void *data)
 
virtual void selectItem (Item *item)=0
 
void selectItemFromAbsoluteCursor (const nkMaths::Point &absCoords)
 
void selectItemFromRelativeCursor (const nkMaths::Point &relCoords)
 
virtual void exportIntrospection (nkExport::Node *rootNode) override
 
virtual void importClassFromTree (nkExport::Node *rootNode) override
 
- Public Member Functions inherited from nkWinUi::Component
 Component (MainSystem *parentSystem)
 
virtual ~Component ()
 
LayoutgetLayout () const
 
ThemegetTheme () const
 
nkMaths::Point getPositionInParent () const
 
nkMaths::Point getPositionInScreen () const
 
int getWidth () const
 
int getHeight () const
 
nkMaths::Rectangle getAreaInParent () const
 
nkMaths::Rectangle getAreaInScreen () const
 
virtual nkMaths::Point getBorderExtents () const
 
virtual float getBorderExtent (BORDER_KIND border) const
 
virtual int getLayoutAllowedWidth () const
 
virtual int getLayoutAllowedHeight () const
 
virtual int getLayoutAllowedOffsetX () const
 
virtual int getLayoutAllowedOffsetY () const
 
bool isInitialized () const
 
ComponentgetParentComponent () const
 
COMPONENT_TYPE getComponentType () const
 
nkMemory::StringView getComponentName () const
 
bool getVisibility () const
 
virtual nkMemory::StringView getLabel () const
 
void * getData () const
 
bool isEnabled () const
 
bool isForegroundWindow () const
 
unsigned int getZDepth () const
 
bool getVisibleOnLoad () const
 
std::function< bool(Component *)> getCloseCallback () const
 
std::function< void(Component *, bool)> getVisibilityCallback () const
 
std::function< void(Component *, const ClickEventData &)> getClickCallback () const
 
std::function< void(Component *, const WheelEventData &)> getWheelCallback () const
 
std::function< void(Component *, const KeyEventData &)> getKeyCallback () const
 
virtual LayoutsetLayout (LAYOUT_TYPE layoutType)
 
virtual void setTheme (Theme *theme)
 
virtual void setPositionInParent (nkMaths::Point position)
 
virtual void setPositionInScreen (nkMaths::Point position)
 
virtual void setSize (int width, int height)
 
virtual void setWidth (int width)
 
virtual void setHeight (int height)
 
void setMinSize (unsigned int width, unsigned int height)
 
void setMaxSize (unsigned int width, unsigned int height)
 
void setRatio (float widthOverHeight)
 
virtual void setAreaInParent (const nkMaths::Rectangle &area)
 
virtual void setAreaInScreen (const nkMaths::Rectangle &area)
 
virtual void setParentComponent (Component *parent, bool makeItVisible=true)
 
virtual void setLabel (const nkMemory::StringView &label)
 
void setComponentName (const nkMemory::StringView &name)
 
virtual void setVisibility (bool value)
 
void setData (void *data)
 
void setEnabled (bool value)
 
void setVisibleOnLoad (bool value)
 
void setCloseCallback (std::function< bool(Component *caller)> callback)
 
void setVisibilityCallback (std::function< void(Component *caller, bool visibility)> callback)
 
void setClickCallback (std::function< void(Component *caller, const ClickEventData &eventData)> callback)
 
void setWheelCallback (std::function< void(Component *caller, const WheelEventData &eventData)> callback)
 
void setKeyCallback (std::function< void(Component *caller, const KeyEventData &eventData)> callback)
 
void addChild (Component *child, bool makeItVisible=true)
 
void removeChild (Component *child)
 
void removeChild (unsigned int index)
 
ComponentgetChild (unsigned int index)
 
unsigned int getChildIndex (Component *child)
 
void unloadWithChildren ()
 
void loadWithChildren ()
 
void updateZDepth ()
 
void bringToForeground ()
 
void focusWindow ()
 
nkMaths::Point getCoordRelativeFromAbsolute (const nkMaths::Point &absCoords)
 
nkMaths::Point getCoordAbsoluteFromRelative (const nkMaths::Point &relCoords)
 
virtual void load ()=0
 
virtual void unload ()=0
 
void reload ()
 
virtual void updateWindow ()
 
nkImages::Image paintToImage (bool withFrame=false)
 
void simulateEvent (const InputDescriptor &inputDescription)
 
void onSized ()
 
virtual void exportClassToTree (nkExport::Node *rootNode) override
 
- Public Member Functions inherited from nkExport::Exportable
 Exportable ()
 
virtual ~Exportable ()
 

Detailed Description

A graphical tree view window.

Constructor & Destructor Documentation

◆ TreeView()

nkWinUi::TreeView::TreeView ( MainSystem parentSystem)

Constructor.

Parameters
parentSystemThe parent system in which the component will live.
Remarks
See ComponentManager::createOrRetrieve().

◆ ~TreeView()

nkWinUi::TreeView::~TreeView ( )

Destructor.

Member Function Documentation

◆ getItemFromData()

Item* nkWinUi::TreeView::getItemFromData ( void *  data) const
Parameters
dataThe data attached to wanted item.
Returns
The item requested if available, nullptr else.

◆ getSelectedItem()

virtual Item* nkWinUi::TreeView::getSelectedItem ( )
pure virtual
Returns
Currently selected item.

◆ getItemAtAbsoluteCursor()

virtual Item* nkWinUi::TreeView::getItemAtAbsoluteCursor ( const nkMaths::Point absCoords)
pure virtual
Parameters
absCoordsThe picking coordinates, absolute on screen.
Returns
The item under given coordinates.

◆ getItemAtRelativeCursor()

virtual Item* nkWinUi::TreeView::getItemAtRelativeCursor ( const nkMaths::Point relCoords)
pure virtual
Parameters
relCoordsThe picking coordinates, relative to the component.
Returns
The item under given coordinates.

◆ getSelectOnRightClick()

bool nkWinUi::TreeView::getSelectOnRightClick ( ) const
Returns
Whether the components selects an item when a right click occurs.

◆ getSelectionCallback()

std::function<void (TreeView*)> nkWinUi::TreeView::getSelectionCallback ( ) const
Returns
Currently set selection callback.

◆ setSelectionOnRightClick()

void nkWinUi::TreeView::setSelectionOnRightClick ( bool  value)

Sets whether a right click should change selection.

Parameters
valueIf a right click selects an item (true) or not (false).

◆ setSelectionCallback()

void nkWinUi::TreeView::setSelectionCallback ( std::function< void(TreeView *)>  value)

Sets the callback used when a selection change happens.

Parameters
valueThe callback to set. The argument will be the calling tree view.
Remarks
The callback is called after the selection occurs.

◆ insertItem()

virtual Item* nkWinUi::TreeView::insertItem ( const std::string_view &  text,
void *  data,
Item parent = nullptr,
Item afterThisOne = nullptr 
)
virtual

Inserts an item within the tree view.

Parameters
textThe text to use for the item.
dataThe user data to attach to the item.
parentThe parent item of item to insert.
afterThisOneItem will be inserted after this one.
Returns
Newly created item fitting all requested conditions. The tree view owns its memory.

◆ deleteItem()

virtual void nkWinUi::TreeView::deleteItem ( Item toDelete,
bool  keepChildrenOnUpper = false 
)
virtual

Erases an item and free its memory.

Parameters
toDeleteThe item to erase.
keepChildrenOnUpperIf the children should be reattached in the tree to the parent of item that should be deleted.

◆ changeItemLabel()

virtual void nkWinUi::TreeView::changeItemLabel ( Item toChange,
const std::string_view &  label 
)
virtual

Changes an item label.

Parameters
toChangeThe item to change.
labelLabel to set.

◆ clearItems()

virtual void nkWinUi::TreeView::clearItems ( )
virtual

Clears all items from the tree.

◆ selectItemFromItsData()

void nkWinUi::TreeView::selectItemFromItsData ( void *  data)

Selects an item.

Parameters
dataThe data attached to the item to select.

◆ selectItem()

virtual void nkWinUi::TreeView::selectItem ( Item item)
pure virtual

Selects an item.

Parameters
itemThe item to select.

◆ selectItemFromAbsoluteCursor()

void nkWinUi::TreeView::selectItemFromAbsoluteCursor ( const nkMaths::Point absCoords)

Sets a selection from a cursor position.

Parameters
absCoordsThe cursor position, absolute on screen.

◆ selectItemFromRelativeCursor()

void nkWinUi::TreeView::selectItemFromRelativeCursor ( const nkMaths::Point relCoords)

Sets a selection from a cursor position.

Parameters
relCoordsThe cursor position, relative to the component.

◆ exportIntrospection()

virtual void nkWinUi::TreeView::exportIntrospection ( nkExport::Node rootNode)
overridevirtual

◆ importClassFromTree()

virtual void nkWinUi::TreeView::importClassFromTree ( nkExport::Node rootNode)
overridevirtual

The documentation for this class was generated from the following file: